package com.codeforces.gym.g100184;

import java.math.BigInteger;
import java.util.Scanner;

public class B {

	static Scanner scanner = new Scanner(System.in);
	static BigInteger n;
	static BigInteger three = new BigInteger("3");

	public static void main(String[] args) {
		n = scanner.nextBigInteger();
		if (n.mod(three).compareTo(BigInteger.ZERO) == 0) {
			System.out.println("yes");
		}
		else {
			System.out.println("no");
		}
	}

}
